import 'package:flutter/material.dart';

extension PaddingWidgets on Widget {
  Widget xh_paddingAll(double value) => Padding(
        padding: EdgeInsets.all(value),
        child: this,
      );
  Widget xh_paddingSymmetric({double vertical = 0.0, double horizontal = 0.0}) =>
      Padding(
        padding:
            EdgeInsets.symmetric(vertical: vertical, horizontal: horizontal),
        child: this,
      );
  Widget xh_paddingOnly(
          {double left = 0.0,
          double top = 0.0,
          double right = 0.0,
          double bottom = 0.0}) =>
      Padding(
        padding:
            EdgeInsets.only(left: left, top: top, right: right, bottom: bottom),
        child: this,
      );
  Widget xh_paddingFromLTRB(
          double left, double top, double right, double bottom) =>
      Padding(
        padding: EdgeInsets.fromLTRB(left, top, right, bottom),
        child: this,
      );
}

extension MarginWidgets on Widget {
  Widget xh_marginAll(double value) => Container(
        margin: EdgeInsets.all(value),
        child: this,
      );
  Widget xh_marginSymmetric({double vertical = 0.0, double horizontal = 0.0}) =>
      Container(
        margin:
            EdgeInsets.symmetric(vertical: vertical, horizontal: horizontal),
        child: this,
      );
  Widget xh_marginOnly(
          {double left = 0.0,
          double top = 0.0,
          double right = 0.0,
          double bottom = 0.0}) =>
      Container(
        margin:
            EdgeInsets.only(left: left, top: top, right: right, bottom: bottom),
        child: this,
      );
  Widget xh_marginFromLTRB(double left, double top, double right, double bottom) =>
      Container(
        margin: EdgeInsets.fromLTRB(left, top, right, bottom),
        child: this,
      );
}

extension SizeBoxWidgets on Widget {
  Widget xh_sizeBoxWarp(double value) => SizedBox(
        width: value,
        height: value,
        child: this,
      );
}

extension ColorBoxWidgets on Widget {
  Widget xh_colorBox(Color color) => ColoredBox(
        color: color,
        child: this,
  );
}

extension AspectRatioWidgets on Widget {
  Widget xh_aspectRatio(double value) => AspectRatio(
        aspectRatio: value,
        child: this,
      );
}

extension CenterWidgets on Widget {
  Widget xh_center() => Center(
        child: this,
      );
}

extension ExpandedWidgets on Widget {
  Widget xh_expanded() => Expanded(
        child: this,
      );
}

extension FittedBoxWidgets on Widget {
  Widget xh_autoFit() {
    return FittedBox(
      fit: BoxFit.contain,
      child: this,
    );
  }
}
extension AlignWidgets on Widget {
  Widget xh_align(AlignmentGeometry value) => Align(
        alignment: value,
        child: this,
      );
}

extension OpacityWidgets on Widget {
  Widget xh_opacity(double value) => Opacity(
        opacity: value,
        child: this,
      );
}

extension VisibilityWidgets on Widget {
  Widget xh_visible(bool value) => Visibility(
        visible: value,
        child: this,
      );
}

extension SafeAreaWidgets on Widget {
  Widget xh_safeArea() => SafeArea(
        child: this,
      );
}

extension ConstrainedBoxWidgets on Widget {
  Widget xh_constrainedBox({required BoxConstraints value}) => ConstrainedBox(
        constraints: value,
        child: this,
      );
}

extension DecoratedBoxWidgets on Widget {
  Widget xh_decoratedBox({required Decoration value}) => DecoratedBox(
        decoration: value,
        child: this,
      );
}

extension TransformWidgets on Widget {
  Widget xh_transform({required Matrix4 value}) => Transform(
        transform: value,
        child: this,
      );
}


extension ClipRRectWidgets on Widget {
  Widget xh_clipRRect({required double value}) => ClipRRect(
        borderRadius: BorderRadius.circular(value),
        child: this,
      );
}


extension ClipOvalWidgets on Widget {
  Widget xh_clipOval() => ClipOval(
        child: this,
      );
}


